package com.ms.module.wechat.clear.base;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public class BaseFragment extends Fragment {

    private View _view;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        int layoutId = getLayoutId();
        if (layoutId != 0) {
            _view = inflater.inflate(getLayoutId(), container, false);
            initView();
            return _view;
        }
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    protected void initView() {

    }

    protected int getLayoutId() {
        return 0;
    }

    public <T> T findViewById(int viewID) {
        return (T) _view.findViewById(viewID);
    }
}
